<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="UTF-8">
  <meta http-equiv="X-UA-Compatible" content="IE=edge">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>Document</title>
  <script>
    function draw() {
      var ctx = document.getElementById('canvas').getContext('2d')
      ctx.translate(100, 100)
      var sin = Math.sin(Math.PI / 6)
      var cos = Math.cos(Math.PI / 6)
      for (var i=0; i<12 ; i++) {
        var c = Math.floor(255 / 12 * i)
        ctx.fillStyle = `rgb(${c}, ${c}, ${c})`
        ctx.transform(cos, sin, -sin, cos, 0, 0)
        ctx.fillRect(0, 0, 100, 10)
      }
      ctx.translate(25, 25)
      var sin2 = Math.sin(Math.PI / 4)
      var cos2 = Math.cos(Math.PI / 4)
      ctx.transform(2 * cos2, 2 * sin2, -2 * sin2, 2 * cos2, 0, 0)
      ctx.fillStyle = "rgba(255, 128, 255, 0.5)";
      ctx.fillRect(0, 0, 50, 50)
    }
  </script>
</head>
<body onload="draw()">
  <canvas id="canvas" width="200" height="270"></canvas>
</body>
</html>